package com.xuecheng.media.config;

import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.profile.DefaultProfile;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@ConfigurationProperties(prefix = "aliyun")
@Configuration
@Data
public class AliyunProperties {

    private String region;
    private String accessKeyId;
    private String accessKeySecret;

    @Bean
    public DefaultAcsClient defaultAcsClient() {
        DefaultProfile profile = DefaultProfile.getProfile(region, accessKeyId, accessKeySecret);
        return new DefaultAcsClient(profile);
    }
}
